Method of Handling a Message

ABSTRACT

A method of handling a message in a messaging system is provided. The messaging system comprises a message source, a message receiver and a message service. The message service is intermediate of the message source and message receiver, wherein a compensation component is established at the message source, The method comprises the steps of, transmitting a one way message, as part of a business transaction, from the message source, the transaction comprising a plurality of one way messages, receiving the message at the message service, transmitting the message from the messaging service, receiving the message at the message receiver, processing the message at the message receiver, transmitting a communication from the message receiver, the communication indicating success or failure of the processing of the message, receiving the communication at the messaging service, and responsive to receiving an indication of a failure of part of the transaction when the communication indicated that processing of the one way message succeeded, causing compensation logic defined by the compensation component to execute.

FIELD

Embodiments of this invention relates to handling a message in a messagecomputer system, and more specifically, embodiments of the inventionrelate to providing an automated application execution guarantee forone-way messages using transactions.

BACKGROUND

In messaging systems, the use of messages and message queues in a widernetwork provide an asynchronous communications protocol, which meansthat the sender and receiver of a message do not need to interact with amessage queue at the same time. Messages placed onto a queue are storeduntil a recipient retrieves them. Such networks support the passing ofmessages between different computer systems, connecting multipleapplications and multiple operating systems. Messages can also be passedfrom queue to queue in order for a message to reach the ultimate desiredrecipient. An example of a commercial implementation of such messagingsoftware is IBM's WebSphere MQ (previously MQ Series).

In a synchronous communication protocol, one system connects to anothersystem, sends a request and waits for a reply. In many situations thisis the ideal method of communicating. For example, a user sends arequest for a web page and then waits for a reply. However, othersystems exist in which such behaviour is not desirable. For example, anapplication may need to notify a different application that an event hasoccurred, but does not need to wait for a response. Another exampleoccurs in publish/subscribe systems, where an application publishes amessage for any number of clients to read. In both these examples itwould not make sense for the sender of the information to have to waitfor a reply, if, for example, one of the recipients had crashed.

Alternatively, an application run by a website, such as an online store,may need to respond to certain parts of a request immediately (such astelling the user that a purchase has been accepted), but may queue otherparts (such as the calculation of invoice amounts and the forwarding ofdata to the central accounting system, and so on) to be done some timelater. In all these sorts of situations, having at least a subsystemwhich does asynchronous message queuing can help improve the performanceof the overall system.

One way messages may be sent reliably and, using a transactional queuingsystem, may be sent as part of the requesting application's transaction.On the receiving side, a message may be received and executed as part ofa separate transaction. Existing messaging systems support assuredmessage “delivery” for asynchronous and time-independent one waycommunication between an application source and an applicationdestination. Such a facility accommodates the possibilities of linkfailure and many other conditions that can arise in complex networks.

The receiver need not be available when a message is transmitted by thesource and the communication path the message traverses may be acrossdifferent execution environments (therefore traditional distributedatomic transactions are not appropriate for messaging). A typical modelis that there are three participants, the message source, the messagingservice and message receiver, each in a different transaction, with themessaging service middleware taking responsibility for delivering themessages reliably between transactions.

Each participant may be doing other work, for example, performingdatabase I/O, dealing with other messages or even taking part in adistributed synchronous transaction with other servers. Typically themessage source places a message on a queue, and it is sent when thetransaction is committed (i.e. the source hands the message to thetransactional messaging service and when the message source commits thetransaction the messaging service “persists” the message to be deliveredto the receiving target so that it can be reliably delivered across anyfailure of the transport). The messaging service provider logically hasa transaction that includes receiving the message from a persistentqueue and placing the message on a queue designated for the messagereceiver. Finally, the message receiver (which may or may not be themessage source) performs a transaction that includes retrieving themessage from a queue and processing the contents of the message (whichmight involve executing a business service). Such a method of operationis known as an ‘unshared-transaction’ between message source and messagereceiver.

SUMMARY

According to a first embodiment of the invention, there is provided amethod of handling a message in a messaging system, the messaging systemcomprising a message source, a message receiver and a message serviceintermediate of the message source and message receiver, wherein acompensation component is established at the message source, the methodcomprising the steps of: transmitting a one way message, as part of abusiness transaction, from the message source, the transactioncomprising a plurality of one way messages, receiving the message at themessage service, transmitting the message from the messaging service,receiving the message at the message receiver, processing the message atthe message receiver, transmitting a communication from the messagereceiver, the communication indicating success or failure of theprocessing of the message, receiving the communication at the messagingservice, and responsive to receiving an indication of a failure of partof the transaction when the communication indicated that processing ofthe one way message succeeded, causing compensation logic defined by thecompensation component to execute.

According to another aspect of an embodiment of the invention, there isprovided a messaging system comprising a message source, a messagereceiver and a message service intermediate of the message source andmessage receiver, wherein a compensation component is established at themessage source, wherein: the message source is arranged to transmit aone way message, wherein the one way message is part of a businesstransaction, the business transaction comprising a plurality of one waymessages, the message service is arranged to receive the message and totransmit the message, the message receiver is arranged to receive themessage, to process the message, and to transmit a communication, thecommunication indicating success or failure of the processing of themessage, and the messaging service is arranged to receive thecommunication, the message service being, responsive to receiving anindication of a failure of part of the transaction when thecommunication indicated that processing of the one way messagesucceeded, operable to cause compensation logic defined by thecompensation component to execute.

According to a another aspect of an embodiment of the invention, thereis provided a method of operating a message source comprising:initiating an action, transmitting a one way message from the messagesource, in response to the action, the one way message being part of abusiness transaction comprising a plurality of one way messages andestablishing a compensation component at the message source, thecompensation component defining actions to be taken, if the processingof the message succeeds, whilst the processing of a part of thetransaction fails.

According to another aspect of an embodiment of the invention, there isprovided a message source arranged to initiate an action, to transmit aone way message from the message source, in response to the action, theone way message being part of a business transaction comprising aplurality of one way messages, the message source being further arrangedto establish a compensation component at the message source, thecompensation component defining actions to be taken, if the processingof the message succeeds, whilst the processing of a part of thetransaction fails.

According to another aspect of an embodiment of the invention, there isprovided a computer program product on a computer readable medium foroperating a message source, the product comprising instructions for:initiating an action, transmitting a one way message from the messagesource, in response to the action, the one way message being part of abusiness transaction comprising a plurality of one way messages, andestablishing a compensation component at the message source, thecompensation component defining actions to be taken, if the processingof the message succeeds whilst the processing of a part of thetransaction fails.

According to a sixth aspect, there is provided a method of operating amessage service in a messaging system, the messaging system comprising amessage source, a message receiver and the message service intermediateof the message source and message receiver, the method comprising thesteps of: receiving a one way message, as part of a businesstransaction, from the message source, the transaction comprising aplurality of one way messages, transmitting the message from themessaging service to the message receiver for processing thereat,receiving a communication from the message receiver, the communicationindicating success or failure of the processing of the message, andresponsive to receiving an indication of a failure of part of thetransaction when the communication indicated that processing of the oneway message succeeded, causing compensation logic defined by acompensation component established at the message source to execute.

According to an other aspect of an embodiment of the invention, there isprovided a message service, operable in a messaging system, themessaging system comprising a message source, a message receiver and themessage service intermediate of the message source and message receiver,the apparatus comprising: means for receiving a one way message, as partof a business transaction, from the message source, the transactioncomprising a plurality of one way messages, means for transmitting themessage from the messaging service to the message receiver forprocessing thereat, means for receiving a communication from the messagereceiver, the communication indicating success or failure of theprocessing of the message, and means, responsive to receiving anindication of a failure of part of the transaction when thecommunication indicated that processing of the one way messagesucceeded, for causing compensation logic defined by a compensationcomponent established at the message source to execute.

The method and system ensure that even if the original message source isdisconnected from the message service, following the sending of themessage, as will happen in an asynchronous system, there is a mechanismfor dealing with the failure of a part of the overall businesstransaction, when the processing of the message (which was also part ofthat transaction) actually succeeded. This is provided by the existenceof the compensation component (established within the source), which isexecuted if needed, and can for example, trigger a subsequent messagespecifying a compensation action be preformed by the message receiver.The originating application at the message source preferably does notneed to wait around in order to drive the compensation since theapplication delegates to the messaging service after the source firesand forgets the original message. The messaging source preferablypre-registers the compensation component with the messaging system.

In one embodiment, the method further comprises receiving a compensationmessage at the message receiver and processing the compensation messageat the message receiver. The compensation component, once executed, cangenerate a compensation message, which can be sent to the originalmessage receiver (or a different message receiver), in order for thatmessage consumer to process the compensation message and carry out thenecessary actions required to correct the situation that has arisenfollowing the failure of the processing of the business transaction.This means that any changes that need to be made, in relation to theservice delivered by the message receiver, can be carried out in themost efficient manner.

In one embodiment, the messaging service comprises a transactionmanagement unit and the method further comprises receiving thecompensation component at the transaction management unit. The use oftransaction management functionality within the messaging systemsupports effective implementation of a number of desired features suchas the monitoring of the delivery and execution of messages.

Ideally, the messaging service comprises one or more queues and the stepof receiving the message at the message service comprises receiving themessage at a queue. Where the messaging service comprises a plurality ofqueues the method further comprises receiving and transmitting themessage by two or more queues in turn. In a preferred embodiment, thereis performed a transaction confirmation for each queue of the two ormore queues in turn. Each movement of the message through the messageservice creates a transaction, which can be considered as creating eachtime a child transaction to the previous transaction, effectivelycreating a nested series of transactions. This enables the transactionunit to be in a position that it is made aware that each hop of themessage through the message service to be completed, and that theultimate processing of the message has also been completed. Eachtransaction is committed if successful or returns a fail communicationif not.

DESCRIPTION OF THE DRAWINGS

Embodiments of the present invention will now be described, by way ofexample only, with reference to the accompanying drawings, in which:—

FIG. 1 is a schematic diagram of a messaging computer system accordingto an embodiment of the invention,

FIGS. 2 to 5 are process flow diagrams of message flow in the messagingsystem according to an embodiment of the invention, and

FIG. 6 is a flowchart of a method of operating the messaging systemaccording to an embodiment of the invention.

DESCRIPTION

FIG. 1 shows a messaging computer system, in a schematic representation.The messaging system comprises a message source 10, a message receiver12 and a message service 14, which is intermediate of the message source10 and the message receiver 12. A single message 16 is shown, firstly asthe message 16 is transmitted from the message source 10 to the messageservice 14, and secondly as the message 16 is transmitted from themessage service 14 to the message receiver 12. The system shown in FIG.1 could be, for example, the back-end system of a retail website whereusers purchase goods. The message source 10 could be a server hostingthe website, and when an action is initiated, such as a user making apurchase, then various messages 16 will be generated, for example, toupdate the user's account, to update stock records, to claim money froma third party account, and so on. The message receiver 12 could be aserver that is maintaining the stock records, for example.

The system of FIG. 1 is modified to provide an improvement over knownsystems. Using transactions which support a long duration, looselycoupled interaction between sender and receiver, there is providedautonomic recovery and guaranteed execution capabilities, which aretransparent to the existing messaging system. An implementation mayconsist either of an adapter that augments the existing messagingservices implementation or modification of the existing messagingservices to provide a shared transaction between the message source 10and the message receiver 12.

The system may use nested transaction relationships in which theindividual unshared transactions (each representing one leg of theoverall message communication) are themselves child participants in asingle distributed, shared parent transaction, as an example, “businessactivity” in WS-BA (web services business activity) parlance. Eachsuccessfully completed nested child transaction may have an associatedcompensating action that is driven in the event of an unsuccessfuloutcome of the overall business transaction. Context from each parenttransaction is propagated to its immediate children. Additionally,compensation logic is provided to automate any necessary recoveryrequired by the communication for the overall transaction betweenmessage source and message receiver. This is may be provided to theintermediate messaging service but equally may exist elsewhere and betriggered by the message service. The system also employs transactionprotocol messages, specifically a completion message, to determine thatany messages have not only been delivered but have also beensuccessfully executed by the message receiver.

Using transactions that support a long-duration, loosely coupledinteraction between the sender 10 and the receiver 12 provides a meansto involve the outcome of the asynchronously, reliably-invoked targetservice in the requester's unit of work (as embodied by the message 16)and to provide autonomic recovery and guaranteed execution capabilitiestransparent to the existing messaging system. As mentioned above, animplementation may consist either of an adapter that augments theexisting messaging service's implementation or a modification of theexisting messaging services to provide a ‘shared-transaction’ betweenthe message source 10 and the message receiver 12 within which theunshared transactions are subordinate participants.

The sequence diagram of FIG. 2 illustrates an example of theend-to-end-flows using a nested sequence. For simplicity, the sequenceillustrates a single PUT from the messaging client 10, but a sequence ofmessages to a single receiver 12 or a series of messages to differentreceivers 12 are modelled in the same way. The message source 10 isshown on the left-hand side of the diagram, and the message receiver 12is shown on the right-hand side, with the messaging service 14in-between. The message service 14 is represented by a pair of queues18.

TX1 represents the overall transaction under which the client 10initiates all its work. TX1 is initiated on the client's behalf but islonger-running than the client application itself; TX1 has achild-participant transaction and is not actually committed until itreceives the “completed” acknowledgement from its child, typically longafter the client 10 has finished processing. A compensation component,which has been established by the messaging source 10, “PUT compensationhandler”, is added to the TX1 activity if the PUT to the first queue 18is successful. Later, if the overall TX1 activity fails, the “PUTcompensation” is executed, and puts another (compensation) message onthe queue 18 to instruct the target 12 to compensate anything it did onforward processing.

The messaging infrastructure, represented by a transaction managementunit, creates a transaction, TX2, as a child-participant of TX1, and themessage is delivered to the target queue 18 as part of TX2. TX2 itselfhas a child-participant transaction and so is not actually committeduntil it receives the “completed” acknowledgement from its ownchild-participant. No explicit compensation handler needs to be addedfor TX2, although TX2 is itself implicitly registered as achild-participant of TX1. The messaging infrastructure creates atransaction TX3, as a child-participant of TX2. Under this transactionthe message is read from the destination queue 18 by the targetapplication 12 and any business logic is executed. No explicitcompensation handler needs to be added for TX3, although TX3 is itselfimplicitly registered as a child-participant of TX2.

If the work of the target 12 fails for reasons of transient resourceunavailability then the message will be redelivered by the messagingsystem. When TX3 commits it send a “completed” message to its parentTX2; this in turn triggers TX2 to send a “completed” message to itsparent TX1. Once TX1 has successfully completed all its processing itsends its compensation handlers and child-participants a “close” message(not shown in the sequence diagram) to clean up. These in turn delegatethis message onto any of their own child-participants.

If the overall transaction TX1 fails, for example because anothermessage sequence, not shown, failed while running in parallel to thisone, then any compensation handlers and child-participants are driven tocompensate. In this scenario, the child-participants do not need toperform any explicit compensation handling; the only compensationhandler that needs to do anything is the “PUT compensation handler”which puts a new message to the transmission queue 18 to ultimatelydrive a processing in the target 12 that will need to compensate forwhat it did under TX3.

FIG. 3 illustrates the similar situation to that shown in the sequencediagram of FIG. 2, but this time with the creation of two messages bythe message source 10, from the application that is being run by thatsource 10. Any user action in relation to the application run by themessage source 10 can create multiple messages, which need to be passedto and processed on the target message receiver 12. These two messagesare put onto a first queue 18 in the messaging service, which createsthe first transaction TX1. The messaging source 10 will establish acorresponding compensation component for the messages.

The transaction management unit, of the messaging service, will thencreate two parallel child transactions TX2 and TX2′, one for each of theoriginal messages. This results in the passing of the respectivemessages to a second queue 18. The notification and getting of themessages from the second queue 18 to the ultimate target messagereceiver 12 in turn creates two further parallel child transactions TX3and TX3′. Although these are shown as dealing with the same target 12,they may have different message receivers 12 as the target consumer ofthe messages.

At the start of the process, the message source 10 also establishes thecompensation component, and this component covers the necessary actionsrequired if either of the messages fail to be processed by the target12, whatever the reason for that failure. In the example of FIG. 3, bothof the transactions TX3 and TX3′ are performed successfully, and theunits of work are committed as transactions, and each child transactionwill result in the parent transaction being completed back to theoriginal transaction TX1. This ensures that the transaction created as aresult of the original receipt of the messages from the message source10 is completed, and the asynchronous work generated by the messages isknown to the messaging service to have been completed. The compensationcomponent could be provided to the messaging service or may existelsewhere and be triggered by the messaging service as necessary.

FIG. 4, however, shows the traffic that occurs when a failure takesplace. The failure in this sequence diagram occurs in relation to thetransaction TX3′. In this example, the target 12 was unable to executethe piece of work embodied by the second message, of the two messagesoriginally provided by the message source 10 to the messaging service.The reason for the failure is not material to the operation of theoverall messaging system. In the example of FIG. 1, the target messagereceiver 12 was a server running a stock record. The failure of theprocessing of the message associated with the transaction TX3′ could be,for example, that since the user made the order, the item that the userwishes to purchase is now no longer in stock.

As a result of the failure of the target message receiver 12 to processthe message, the TX3′ transaction will return a fail communication. Thisfail communication, shown as the arrow marked “failed” in the sequencediagram of FIG. 4, will be passed to the parent transaction TX2′. Thiscauses the parent transaction TX2 to fail. In a similar fashion, theparent transaction TX2′ will also return a fail communication, againshown as the arrow “failed”, and transaction TX1 will also fail. Thetotal result of this fail communication trail is that the transactionmanagement unit in the message service may register a fail condition forthe entire transaction, indicating therefore that the work embodied bythe specific message has not been carried out.

Upon receiving the fail communication at the messaging service, andbecause the communication indicates a failure of the processing of thework embodied by the second message, the messaging service is arrangedto execute the compensation component, for example by transmitting a newmessage to the target message receiver 12. The compensation logic thatwas supplied with the original messages, shown as the arrow“AddPutCompensation” in the sequence diagram, provides the recoveryfunction in the asynchronous process of handling the message.

The processing that occurs in the system following the failurecommunication reaching the transaction management unit is illustrated bythe sequence diagram of FIG. 5. This diagram is augmented by acompensation handler 20, which is part of the message service, and maybe located, for example, within the functionality of the transactionmanagement unit. The compensation handler 20 is responsible forinitiating the actions that will “repair” any damage caused by thefailure of the processing of one or more of the original message(s) whenthe processing of work related to one message sent in the sametransaction has succeeded. The compensation handler 20 can be added toan existing messaging system, in order to embody the functionality thatis required in the improved asynchronous messaging system.

The nature of the compensation will be specific to the character of thework that was embodied by the message that failed. For example, theexecution of the compensation component may specify reversal of certainactions taken, or may specify new actions. For example, the originalmessage might be to order an item from a merchant and a second messagemight be an instruction to draw money from a customer's third partyaccount. If the operation triggered by the second message fails throughlack of funds in the customer's account, then compensation logic definedby the compensation component, sent by the compensation handler 20, maydenote an excess charge to the user's account and a cancellation of theoriginal order. The operation of the messaging service is not such thatit is determining what compensation should take place, the originatingmessage source 10 specifies the compensation component.

If the compensation handler 20 has executed the compensation componentand been instructed to transmit a compensation message to the messagereceiver 12, then the compensation handler 20 will place the relevantcompensation message onto a queue 18 within the messaging service. Thiscompensation message will then flow through the messaging service likeany other message, until it reaches the target message receiver 12.Child transactions will be created as the compensation message passesthrough individual queues 18 within the messaging service, as can beseen by the child transactions TXC2 and TXC3 within the sequencediagram. The message receiver 12 receives the compensation message andprocessing of the compensation message takes place at the messagereceiver 12. This transaction is committed once completed, andcompletion messages flow back through the message service, through thechild transactions, to confirm that the compensation has been carriedout successfully.

The method of operating the overall messaging system is summarised inFIG. 6. This Figure shows a flowchart of the processing that occursafter the generation of the message 16, at an application that is beingrun by the message source 10. After an action is initiated at themessage source 10, then the first step of the method is the step S1 oftransmitting the message 16 from the message source 10 to the messageservice 14. The message is part of a business transaction comprising aplurality of messages. At the same time, step S2 is performed, whichcomprises establishing the compensation component at the message source10. The compensation logic may also be transmitted to the messageservice or may be registered elsewhere.

The third step, step S3, is the step of receiving the message 16 at themessage service 14, and transmitting the message 16 from the messagingservice 14. As discussed above, the receipt and transmittal of themessage 16 by the messaging service 14 may include passing the message16 through intermediate nodes of the messaging service 14, where suchnodes may be queues 18, for example.

The next step S4 is the step of receiving the message 16 at the messagereceiver 12, and processing the message 16 at the message receiver 12.The receipt by the message receiver 12 of the message 16 may be achievedby the messaging service 14 informing the receiver 12 that a message 16is available on a specific queue 18, and the message receiver 12 willget the message 16 from that queue 18 when the receiver 12 is ready toperform the processing of the specific message 16.

Once the processing of the message 16 has been successfully completed,or has failed, then the next step is the step S5 of transmitting acommunication from the message receiver 12, the communication indicatingsuccess or failure of the processing of the message 16. Thiscommunication is used so that the transaction protocols being used inthe system will have a guarantee of execution of the original message16, not just of the delivery of the message 16. In the explanation ofthe messaging system, for clarity purposes, the term “message” has beenused to mean the unit of work passed to the message receiver 12, and“communication” has been used to mean the confirmation passed back fromthe message receiver 12. However, in the context of a messaging systemthe “message” and “communication” will both be of the same format andwill be handled in the same way. Different terms have been used toclearly indicate which is meant in the explanation.

The next step is the step S6 of receiving the communication at themessaging service 14. An indication of success or failure is thenprovided to the message source. An indication may also be received toindicate failure of the overall business transaction. If the overallbusiness transaction failed when processing of the original messagesucceeded, then, the final step S7 of executing the compensationcomponent is carried. This execution may comprise the generation of anew compensation message(s), depending upon the nature of the failure,for transmitting to the message receiver 12. The message receiver 12will receive the compensation message and process that message. In thisway, the messaging service 14 is aware that either the processing wassuccessful (not just that the message 16 was delivered) or that theprocessing failed. If the processing failed, then there is an automatichandling of the compensation necessary to balance the error, without theneed of any administrator intervention, nor needing to return to theoriginator of the message 16, the message source 10, which in anasynchronous system, will likely no longer be available.

As will be appreciated by one skilled in the art, the present inventionmay be embodied as a system, method or computer program product.Accordingly, the present invention may take the form of an entirelyhardware embodiment, an entirely software embodiment (includingfirmware, resident software, micro-code, etc.) or an embodimentcombining software and hardware aspects that may all generally bereferred to herein as a “circuit,” “module” or “system.” Furthermore,the present invention may take the form of a computer program productembodied in any tangible medium of expression having computer-usableprogram code embodied in the medium.

Any combination of one or more computer usable or computer readablemedium(s) may be utilized. The computer-usable or computer-readablemedium may be, for example but not limited to, an electronic, magnetic,optical, electromagnetic, infrared, or semiconductor system, apparatus,device, or propagation medium. More specific examples (a non-exhaustivelist) of the computer-readable medium would include the following: anelectrical connection having one or more wires, a portable computerdiskette, a hard disk, a random access memory (RAM), a read-only memory(ROM), an erasable programmable read-only memory (EPROM or Flashmemory), an optical fiber, a portable compact disc read-only memory(CD-ROM), an optical storage device, or a magnetic storage device. Notethat the computer-usable or computer-readable medium could even be paperor another suitable medium upon which the program is printed, as theprogram can be electronically captured, via, for instance, opticalscanning of the paper or other medium, then compiled, interpreted, orotherwise processed in a suitable manner, if necessary, and then storedin a computer memory. In the context of this document, a computer-usableor computer-readable medium may be any medium that can contain, store,communicate, propagate, or transport the program for use by or inconnection with the instruction execution system, apparatus, or device.The computer usable program code may be transmitted using anyappropriate medium, including but not limited to wireless, wireline,optical fiber cable, RF, etc.

Computer program code for carrying out operations of the presentinvention may be written in any combination of one or more programminglanguages, including an object oriented programming language such asJava, Smalltalk, C++ or the like and conventional procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The program code may execute entirely on the user's computer,partly on the user's computer, as a stand-alone software package, partlyon the user's computer and partly on a remote computer or entirely onthe remote computer or server. In the latter scenario, the remotecomputer may be connected to the user's computer through any type ofnetwork, including a local area network (LAN) or a wide area network(WAN), or the connection may be made to an external computer (forexample, through the Internet using an Internet Service Provider).

It will be appreciated that the embodiments of the invention asdescribed will ensure that even if the original message source isdisconnected from the message service, following the sending of themessage, as will happen in an asynchronous system, there is a mechanismfor dealing with the failure of a part of the overall businesstransaction, when the processing of the message (which was also part ofthat transaction) actually succeeded. This is provided by the existenceof the compensation component (established within the source), which isexecuted if needed, and can for example, trigger a subsequent messagespecifying a compensation action be preformed by the message receiver.The originating application at the message source preferably does notneed to wait around in order to drive the compensation since theapplication delegates to the messaging service after the source firesand forgets the original message. The messaging source preferablypre-registers the compensation component with the messaging system.

Furthermore, it is understood that the messaging service comprises oneor more queues and the step of receiving the message at the messageservice comprises receiving the message at a queue. Where the messagingservice comprises a plurality of queues the method further comprisesreceiving and transmitting the message by two or more queues in turn. Ina preferred embodiment, there is performed a transaction confirmationfor each queue of the two or more queues in turn. Each movement of themessage through the message service creates a transaction, which can beconsidered as creating each time a child transaction to the previoustransaction, effectively creating a nested series of transactions. Thisenables the transaction unit to be in a position that it is made awarethat each hop of the message through the message service to becompleted, and that the ultimate processing of the message has also beencompleted. Each transaction is committed if successful or returns a failcommunication if not.

Also, as described the method further comprises receiving a compensationmessage at the message receiver and processing the compensation messageat the message receiver. The compensation component, once executed, cangenerate a compensation message, which can be sent to the originalmessage receiver (or a different message receiver), in order for thatmessage consumer to process the compensation message and carry out thenecessary actions required to correct the situation that has arisenfollowing the failure of the processing of the business transaction.This means that any changes that need to be made, in relation to theservice delivered by the message receiver, can be carried out in themost efficient manner.

1. A method of handling a message in a messaging system, the messagingsystem comprising a message source, a message receiver and a messageservice intermediate of the message source and message receiver, whereina compensation component is established at the message source, themethod comprising the steps of: transmitting a one way message, as partof a business transaction, from the message source, the transactioncomprising a plurality of one way messages, receiving the message at themessage service, transmitting the message from the messaging service,receiving the message at the message receiver, processing the message atthe message receiver, transmitting a communication from the messagereceiver, the communication indicating success or failure of theprocessing of the message, receiving the communication at the messagingservice, and responsive to receiving an indication of a failure of partof the transaction when the communication indicated that processing ofthe one way message succeeded, causing compensation logic defined by thecompensation component to execute.
 2. A method according to claim 1,wherein the step of executing the compensation component comprisesgenerating a compensation message, and the method further comprisesreceiving the compensation message at a message receiver and processingthe compensation message at the message receiver.
 3. A method accordingto claim 1, wherein the messaging service comprises a transactionmanagement unit and the method further comprises receiving thecompensation component at the transaction management unit.
 4. A methodaccording to claim 1, wherein the messaging service comprises one ormore queues and the step of receiving the message at the message servicecomprises receiving the message at a queue.
 5. A method according toclaim 4, wherein the messaging service comprises a plurality of queues,and the method further comprises receiving and transmitting the messageby two or more queues in turn.
 6. A method according to claim 5, andfurther comprising performing a transaction confirmation for each queueof the two or more queues in turn.
 7. A messaging system comprising amessage source, a message receiver and a message service intermediate ofthe message source and message receiver, wherein a compensationcomponent is established at the message source, wherein: the messagesource is arranged to transmit a one way message, wherein the one waymessage is part of a business transaction, the business transactioncomprising a plurality of one way messages, the message service isarranged to receive the message and to transmit the message, the messagereceiver is arranged to receive the message, to process the message, andto transmit a communication, the communication indicating success orfailure of the processing of the message, and the messaging service isarranged to receive the communication, the message service being,responsive to receiving an indication of a failure of part of thetransaction when the communication indicated that processing of the oneway message succeeded, operable to cause compensation logic defined bythe compensation component to execute.
 8. A system according to claim 7,wherein the message service is arranged, when executing the compensationcomponent, to generate a compensation message and to transmit thecompensation message, and a message receiver is arranged to receive thecompensation message and to process the compensation message.
 9. Asystem according to claim 7, wherein the messaging service comprises atransaction management unit and the transaction management unit isarranged to receive the compensation component.
 10. A system accordingto claim 7, wherein the messaging service comprises one or more queuesand a queue is arranged to receive the message.
 11. A system accordingto claim 10, wherein the messaging service comprises a plurality ofqueues and the messaging service is arranged to receive and transmit themessage through two or more queues in turn.
 12. A system according toclaim 11, wherein the messaging service is arranged to perform atransaction confirmation for each queue of the two or more queues inturn.
 13. A method of operating a message source comprising: initiatingan action, transmitting a one way message from the message source, inresponse to the action, the one way message being part of a businesstransaction comprising a plurality of one way messages and establishinga compensation component at the message source, the compensationcomponent defining actions to be taken, if the processing of the messagesucceeds, whilst the processing of a part of the transaction fails. 14.A message source arranged to initiate an action, to transmit a one waymessage from the message source, in response to the action, the one waymessage being part of a business transaction comprising a plurality ofone way messages, the message source being further arranged to establisha compensation component at the message source, the compensationcomponent defining actions to be taken, if the processing of the messagesucceeds, whilst the processing of a part of the transaction fails. 15.A computer program product on a computer readable medium for operating amessage source, the product comprising instructions for: initiating anaction, transmitting a one way message from the message source, inresponse to the action, the one way message being part of a businesstransaction comprising a plurality of one way messages, and establishinga compensation component at the message source, the compensationcomponent defining actions to be taken, if the processing of the messagesucceeds whilst the processing of a part of the transaction fails.
 16. Amethod of operating a message service in a messaging system, themessaging system comprising a message source, a message receiver and themessage service intermediate of the message source and message receiver,the method comprising the steps of: receiving a one way message, as partof a business transaction, from the message source, the transactioncomprising a plurality of one way messages, transmitting the messagefrom the messaging service to the message receiver for processingthereat, receiving a communication from the message receiver, thecommunication indicating success or failure of the processing of themessage, and responsive to receiving an indication of a failure of partof the transaction when the communication indicated that processing ofthe one way message succeeded, causing compensation logic defined by acompensation component established at the message source to execute. 17.A message service, operable in a messaging system, the messaging systemcomprising a message source, a message receiver and the message serviceintermediate of the message source and message receiver, the apparatuscomprising: means for receiving a one way message, as part of a businesstransaction, from the message source, the transaction comprising aplurality of one way messages, means for transmitting the message fromthe messaging service to the message receiver for processing thereat,means for receiving a communication from the message receiver, thecommunication indicating success or failure of the processing of themessage, and means, responsive to receiving an indication of a failureof part of the transaction when the communication indicated thatprocessing of the one way message succeeded, for causing compensationlogic defined by a compensation component established at the messagesource to execute.